/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.controller;

import cn.webrx.mapper.DbMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.SpringVersion;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import org.springframework.web.servlet.ModelAndView;
import org.thymeleaf.Thymeleaf;

import java.util.List;

/**
 * <p>Project: ssm - IndexController
 * <p>Powered by webrx On 2021-11-24 16:29:04
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@Controller
@Api(value = "项目首页测试接口",tags = "IndexController-api")
public class IndexController {
    @Autowired
    private DbMapper dm;
    @RequestMapping
    @ApiOperation(value = "测试index",notes = "显示项目首页index()")
    public ModelAndView index(){
        ModelAndView mv = new ModelAndView();
        mv.addObject("tv", Thymeleaf.getVersion());
        mv.addObject("sv", SpringVersion.getVersion());
        mv.addObject("smv", SpringVersion.getVersion());
        mv.addObject("mv", "3.5.7");
        mv.addObject("msv", dm.version());
        mv.addObject("ts",dm.tbs());
        mv.setViewName("index");
        return mv;
    }

    @GetMapping("/tbs") @ResponseBody
    public List<String> tbs(){
        return  dm.tbs();
    }

    @RequestMapping("/hello") @ResponseBody
    public String hello(){
        return "hello 中文效果";
    }
}
